<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDriverWithdrawTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('driver_withdraw', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('company_id')->index()->comment('公司ID');
            $table->bigInteger('driver_id')->comment('司机ID');
            $table->decimal('money', 10, 2)->default(0)->comment('提现金额');
            $table->enum('status', [1, 2, 3, 4])->default(1)->comment('状态：1-待审核，2-成功，3-驳回，4-打款中');
            $table->bigInteger('wallet_id')->comment('司机提现账号ID');
            $table->bigInteger('admin_id')->nullable()->comment('审核人');
            $table->timestamp('review_time')->nullable()->comment('审核时间');
            $table->char('withdraw_sn', 19)->comment('提现流水号');
            $table->string('remit_sn', 30)->nullable()->comment('第三方流水号');
            $table->timestamps();
        });

        \DB::statement("ALTER TABLE `driver_withdraw` comment '司机提现表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('driver_withdraw');
    }
}
